goog.provide('GLL.Game');

(function(){

	GLL.Game.LoginName = '';
	GLL.Game.LoginPwd = '';
	
})();

/*
 *@return {string} image file path
 */
GLL.Game.getImgPath = function(fileName)
{
	return "IMG\\" + fileName;
}

GLL.Game.getResFile = function(id)
{
	switch(id){
		case 'machine_base': return "machine_base.bmp";
		case 'gun1': return "Gun.gif";
		case 'rotate': return "rotate.gif";
		case 'wpn_frg' : return "weapforge.bmp";
		case 'ElemExit' : return "ElemExit.PNG";
		case 'ElemLeser' : return "ElemLeser.PNG";
		case 'ElemFire' : return "ElemFire.PNG";
		case 'ElemErase' : return "ElemErase.PNG";
	}
	return "NULL.PNG";
}

GLL.Game.getPicPathName = function(id)
{
	var resFileName = GLL.Game.getResFile(id);
	return GLL.Game.getImgPath(resFileName);
}

GLL.Game.Init = function()
{
	this.jsonp_saveKV = new goog.net.Jsonp('http://127.0.0.1/SaveKeyValue.php');
	this.jsonp_loadKV = new goog.net.Jsonp('http://127.0.0.1/LoadKeyValue.php');
	this.jsonp_saveIMG = new goog.net.Jsonp('http://127.0.0.1/SaveImg.php');
}

GLL.Game.SaveKeyVal = function(key, val, callback){
	this.jsonp_saveKV.send({'callback': callback, 'key' : key, 'val' : val});
}

GLL.Game.GetKey = function(key, callback){
	this.jsonp_loadKV.send({'callback': callback, 'key' : key});
}

GLL.Game.SaveImg = function(data, file){
	this.jsonp_saveIMG.send({'d' : data, 'f' : file});
}